<?php
	include("common.php");
	$keyword = $_GET['find'];
	createHeader("Search");
	contentHeader();
	$sqlConnection = mysql_connect("localhost", "aaronthebard", "StrongP@ssw0rd");
	if (!$sqlConnection)
		die("<html>OMFG Error: Unable to connect to SQL server!</html>");
	mysql_select_db("hpberry", $sqlConnection);
	$searchTitleQuery = 'SELECT * FROM articles WHERE title="'.$keyword.'"';
	$titleResults = mysql_query($searchTitleQuery, $sqlConnection);
	$count = 0;
	while ($row = mysql_fetch_array($titleResults)) {
		content($row['title'], $row['image'], $row['body']);
		$count += 1;
	}
	if ($count == 0)
		content("Search Results", "stuxnet.jpg", "No articles with that title were found.");
	contentFooter();
	footer();
?>